<?php

/**
 * 单页
 *
 * @package         YDCMS
 * @author          QQ:644157559 <644157559@qq.com>
 * @version         $Id: PageModel.class.php v1.0 2014-06-13 17:27:03 $
 */
namespace Admin\Model;
class PageModel extends CommonModel{
    protected $_validate = array(
        //array(验证字段2,验证规则,错误提示,[验证条件,附加规则,验证时间]),
        array("title", "require", "页面标题必填！", 1),
        array("nid", "require", "页面标识必填！", 1),
        array('lang', "checkLang", '语言选择有误！', 2, 'callback'), 
    );
    
    protected $_auto = array(
        //array(完成字段2,完成规则,[完成条件,附加规则]),
        array("uptime", "time", 3, "function")
    );
    
    /**
     * 检查语言是否存在
     * @param type $lang
     * @return type
     */
    public function checkLang($lang) {
        return D("Language", "Service")->existLang($lang);
    }
}
